package com.insigma.business.qrcode.appmgt.controller;

import com.insigma.business.qrcode.appmgt.service.SoldierPretreatCardService;
import com.insigma.business.qrcode.common.vo.BaseResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;

@Slf4j
@Api(value = "优待证管理")
@RequestMapping("/web/soldierPretreatCard")
@RestController("soldierPretreatCardController")
public class SoldierPretreatCardController {
    @Resource
    SoldierPretreatCardService soldierPretreatCardService;

    @ApiOperation("优待证下载导入模板")
    @PostMapping("/downloadPretreatCardTemplate")
    public void downloadCourtCardTemplate(HttpServletResponse response) throws Exception {
        soldierPretreatCardService.downloadTemplate(response);
    }

    @ApiOperation("导入优待证信息")
    @PostMapping("/importPretreatCardInfo")
    public BaseResponse<String> importCourtCardInfo(MultipartFile file) throws Exception {
        return soldierPretreatCardService.importCourtCardInfo(file);
    }
}
